<extend name="Public/layout"/>
<block name="head">
<link rel="stylesheet" href="__PUBLIC__css/person-mine.css">
<style type="text/css">
.footer{
  display: none;
}
<link rel="stylesheet" href="__PUBLIC__css/usercenter.css">
</style>
</block>
    
   <block name="main">
      <div class="container">  

        <if condition="$user.role eq 2">
          <!-- 投顾头部 -->
          <div class="title">
            <div class="title-banner">
              <img src="__PUBLIC__images/person_banner.png">
            </div>
            <div class="title-person clearfix">
             
			<div class="per-img"  onclick="changeAvatar()">
				<img src="{$user.url_img}" id='uploadPreview' height="130" width="130"> 
				<input id="uploadImage" style="display:none" type="file" onchange="loadImageFile()">
			</div>
			
              <div class="per-name">
                <h4>{$user.nickname}</h4>
              </div>
              <div class="per-btn">
                <a class="per-chat" onclick="location.href='/Home/Person/edit_profile/id/{$_SESSION[user][id]}'">编辑资料</a>
              </div>
            </div>
            <div class="title-have">
            <!-- <a class="master">师父<span>{$sf_count}</span></a> -->
              <a class="apprentice" <if condition="$r_info.fans_count gt 0"> onclick="location.href='/Home/Circle/pupil_list'"   </if> >徒弟<span>{$r_info.fans_count}</span></a>
              
            </div>
            <div class="title-ex">
              <p class="year">网贷投资<span>{$r_info.year}年</span></p>
              <p class="boom">踩雷次数<span>{$r_info.pit_num}雷</span></p>
              <p class="plat">投资平台<span>{$r_info.platform_num}家</span></p>
            </div>
            <div class="title-money">
              <p class="have">8号金币<span>{$user.score}</span></p>
              <a class="get">获取金币</a>
            </div>
          </div>
          <div class="intro">
          <p>简介：{$r_info.introduce|default="这家伙很懒，什么也没留下"}</p>
        </div>
        <else/>
          <!-- 投资者头部 -->
          <div class="title instor" >
            <div class="title-banner">
              <img src="__PUBLIC__images/person_banner.png">
            </div>
            <div class="title-person clearfix">
              <div class="per-img">
                <img src="{$user.url_img}" height="130" width="130">
              </div>
              <div class="per-name">
                <h4>{$user.nickname}</h4>
              </div>
            <!--   <div class="per-btn">
                <a class="per-chat">编辑资料</a>
              </div> -->
            </div>
            <div class="title-have">
              <a class="master">师父<span>{$sf_count}</span></a>
              <a class="apprentice" href="/Home/recommend/apply_pusher">我要收徒</a>
              
            </div>
            <div class="title-money">
              <p class="have">8号金币<span>{$user.score}</span></p>
              <!-- <a class="get">获取金币</a> -->
            </div>
          </div>
         <!--  <div class="intro">
          <p>简介：{$v.introduce}</p>
        </div> -->
        </if>
        

        <div class="my-tou">
        <!-- 投顾中心 -->
        <if condition="$user.role eq 2">
          <ul class="clearfix">
            <li>
              <a href="/Home/Person/index" class="tou-center">
                <img class="icon_tou" src="__PUBLIC__images/icon_tou.png">
                <h4>投资中心</h4>
                <img class="icon_next" src="__PUBLIC__images/icon_next.png" height="25" width="16">
              </a>
            </li>
            <li>
              <a href="/Home/Person/push_index" class="tou-center">
                <img class="icon_tou" src="__PUBLIC__images/icon_gu.png" height="44" width="44">
                <h4>投顾账户</h4>
                <img class="icon_next" src="__PUBLIC__images/icon_next.png" height="25" width="16">
              </a>
            </li>
          </ul>
          <else/>
          <!-- 投资者中心 -->
          <ul class="my-instor clearfix">
            <li>
              <a  href="/Home/Person/index"  class="tou-center">
                <img class="icon_tou" src="__PUBLIC__images/icon_tou.png">
                <h4>投资中心</h4>
                <img class="icon_next" src="__PUBLIC__images/icon_next.png" height="25" width="16">
              </a>
            </li>
          </ul>
        </if>
        </div>

        <div class="content">
        <if condition="$user.role eq 2">
          <!-- 投顾切换 -->
          <div class="tab">
            <ul class="clearfix">
              <li>
                <div>
                  <h4 class="mc tab-active">消息</h4>
                  <!-- <span>8</span> -->
                </div>
              </li>
              <li>
                <div>
                  <h4 class="vp">观点</h4>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="ch">聊天</h4>
                   <if condition="$chat_count gt 0">
                    <span class="chat">{$chat_count}</span>
                  </if>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="sug">红包</h4>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="cheats">秘籍</h4>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="life">生活</h4>
                </div>
              </li>
            </ul>
          </div>
        <else/>
          <!-- 投资者切换 -->
          <div class="instro-tab tab">
            <ul class="clearfix">
              <li>
                <div>
                  <h4 class="mc tab-active">消息</h4>
                  <!-- <span>8</span> -->
                </div>
              </li>
              <li>
                <div>
                  <h4 class="ch">聊天</h4>
                  <if condition="$chat_count gt 0">
                    <span class="chat">{$chat_count}</span>
                  </if>
                </div>
              </li>
              <li>
                <div>
                  <h4 class="vp">观点</h4>
                </div>
              </li>
            </ul>
          </div>
        </if>
          <!-- 与我相关 -->
          <div class="my-con clearfix">
            <div class="my-title clearfix">
              <h4>全部动态</h4>
              <img class="more" src="__PUBLIC__images/more.png">
            </div>
            <!-- 弹窗筛选 -->
            <div class="navigation">
              <ul>
                <li>
                  <a href="javascript:" onclick="change(1)">
                    <p>评论</p>
                  </a>
                </li>
                <li>
                  <a href="javascript:" onclick="change(2)">
                    <p>点赞</p>
                  </a>
                </li>
                <li>
                  <a href="javascript:" onclick="change(3)">
                    <p>关注</p>
                  </a>
                </li>
                <li>
                  <a href="javascript:" onclick="change(4)">
                    <p>师父动态</p>
                  </a>
                </li>
              </ul>
            </div>
            <div class="my-active">
            <foreach name="r" item="v">
              <if condition="$v.type eq 1 or $v.type eq 2 or $v.type eq 3 or $v.type eq 4">
              
              <!-- 在某平台发表了评论没有添加标签 -->
              <div class="comment-notip clearfix">
                <div class="dy-left">
                  <img src="{$v.user.url_img}">
                </div>
                <div class="dy-right clearfix">
                  <div class="dy-who">
                    <p>{$v.user.nickname}</p>
                  </div>
                  <div class="dy-where">
                    <p>在<a  href="/Home/Circle/circle_info/id/{$v.platform_id}">{$v.platname}圈子</a>发表了平台{$v.tage}</p>
                  </div>
                  <if condition="$v.type eq 1">
                   <notempty name="v.tag.0">
                   <div class="header-bottom clearfix">
                      <ul>
                        <volist name="v.tag" id="vo" offset="0" length='3'>
                        <li>
                          <span>{$vo}</span>
                        </li>
                        </volist>
                      </ul>
                    </div>
                    </notempty>
                  </if>
                  <div class="dy-con">
                    <if condition="$v.type eq 1" >
                    <a href="{$v.url}">{$v.evaluate}</a>
                    <elseif condition="$v.type eq 2" />
                     <a href="{$v.url}">{$v.announce}</a>
                    <elseif condition="$v.type eq 3" />
                    <a href="{$v.url}">{$v.content}</a>
                    <elseif condition="$v.type eq 4" />
                    <a href="{$v.url}/platform_id/{$v.platform_id}">{$v.strength}</a>
                    </if>
                  </div>
                  <div class="item-time">
                    <p>{$v.add_time|date="Y-m-d",###}</p>
                  </div>
                  <div class="item-left">

                    <if condition="$v.is_praise eq 0">
                    <div class="item-no" onclick="praise(this,{$v.type},'{$v.id}')">
                      <img src="__PUBLIC__images/comment-no.png" height="26" width="28">
                    <else/>
                    <div class="item-good" onclick="praise(this,{$v.type},'{$v.id}')">
                      <img src="__PUBLIC__images/comment-good.png" height="26" width="28">
                    </if>

                      <span>{$v.praise}</span>
                    </div>
                   <div class="item-com">
                          <span onclick="location.href='{$v.url}'" class="reback">回复</span>
                        </div>
                  </div>
                </div>
              </div>
              <elseif condition="$v.type eq 5 or $v.type eq 6 or $v.type eq 7 or $v.type eq 8"/>
                  <div class="reback clearfix">
                    <div class="dy-left">
                      <img src="{$v.user.url_img}">
                    </div>
                    <div class="dy-right clearfix">
                      <div class="dy-who">
                        <p>{$v.user.nickname} <span>{$v.content}</span></p>
                      </div>
                      
                        <if condition="$v.type_id eq 10 or $v.type_id eq 11 or $v.type_id eq 12 or $v.type_id eq 13">
                      <div class="dy-con">
                        <!-- <p>{$v.comment_count}</p> -->
                        <span onclick="location.href='{$v.url}'" class="reback-detail">{$v.comment_count}</span> 
                      </div>
                        </if>
                      <div class="dy-original clearfix">
                        <div class="dy-where">
                          <p>在<a  href="/Home/Circle/circle_info/id/{$v.info.platform_id}">{$v.info.platname}圈子</a>发表了平台{$v.info.tage}</p>
                        </div>
                        <if condition="$v.type eq 5" >
                         <div class="dy-con">
                          <a  href="{$v.url}">{$v.info.evaluate}</a>
                        </div>
                        <elseif condition="$v.type eq 6" />
                         <div class="dy-con">
                          <a  href="{$v.url}">{$v.info.strength}</a>
                        </div>
                        <elseif condition="$v.type eq 7" />
                         <div class="dy-con">
                          <a  href="{$v.url}">{$v.info.content}</a>
                        </div>
                        <elseif condition="$v.type eq 8" />
                         <div class="dy-con">
                          <a  href="{$v.url}">{$v.info.announce}</a>
                        </div>
                        </if>

                       
                      </div>
					<div class="item-time">
                        <p>{$v.add_time|date="Y-m-d",###}</p>
                    </div>
                       <if condition="$v.type_id eq 10 or $v.type_id eq 11 or $v.type_id eq 12 or $v.type_id eq 13">
                     
                      <div class="item-left">
                      <if condition="$v.is_praise eq 0">
                      <div class="item-no" onclick="comment_praise(this,'{$v.comment_id}')">
                          <img src="__PUBLIC__images/comment-no.png" height="26" width="28">
                      <else/>
                      <div class="item-good" onclick="comment_praise(this,'{$v.comment_id}')">
                          <img src="__PUBLIC__images/comment-good.png" height="26" width="28">
                      </if>

                        
                          <span>{$v.comment_praise}</span>
                        </div>
                       
                         <div class="item-com">
                          <span onclick="location.href='{$v.url}'" class="reback">回复</span>
                        </div>
                      </div>
                       </if>
                    </div>
                  </div>

                <elseif condition="$v.type eq 9 or $v.type eq 10"/>
                   <div class="attention clearfix">
                    <div class="dy-left">
                      <img src="{$v.user.url_img}">
                    </div>
                    <div class="dy-right clearfix">
                      <div class="dy-who">
                        <p>{$v.user.nickname} <span>{$v.content}</span></p>
                      </div>
                      <div class="attention-time">
                        <p>{$v.add_time|date="Y-m-d",###}</p>
                      </div>
                    </div>
                  </div>
              </if>
            </foreach>
             

              <!-- 在某平台发表了评论 -->
              

            </div>
          </div>

          <!-- 聊天 -->
          <div class="chat-con">
            <div class="search">
              <div id="form">
                <input class="search-inp" type="text" />
                <div class="placehold">
                  <img src="__PUBLIC__images/search-person.png">
                  <p>搜索</p>
                </div>
              </div>
              
              <span>取消</span>
            </div>
            <div class="chat-list" id="list">
              <ul>
                
              </ul>
            </div>
          </div>
           <!-- 观点 -->
          <div class="viewport">
            <div class="dynamic-con">
                <ul>
                 
             
                </ul>
              </div>
          </div>
          <!-- 推荐 -->
          <div class="my-platform">
            <div class="my-plat-title">
              <p>设置红包金额<span><!--师父可自由调整返给徒弟的红包金额哦--></span></p>
            </div>
           <div class="my-platform-content">
            <ul class="my-platform-wrapper">
                <foreach name="platform_list" item="v">
                    <li class="my-platform-item">
                        <div class="platform-wrapper">
                            <!--给下面的platform-item循环-->
                            <foreach name="v.scheme" item="vv">
                                <div class="platform-item">
                                    <div class="item-header">
                                        <div class="plat-logo-wrapper">
                                            <img src="{$v.pic}?x-oss-process=image/resize,w_110" alt="">
                                        </div>
                                        <div class="plat-return-type-wrapper">
                                            <p>首投奖励</p>
                                        </div>
                                    </div>
                                    <div class="item-title">
                                      <div class="item-num">
                                        <h4>投资{$vv.scheme}</h4>
                                      </div>
                                      <div class="spread-btn-wrapper">
                                        <a class="spread-btn"
                                               href="/Home/circle/set_pack/platform_id/{$vv.platform_id}">设置红包金额</a>
                                        </div>
                                    </div>
                                    <div class="item-content">
                                            <ul class="item-content-wrapper">
                                                <li>
                                                    <p><em>{$vv.p_user_award}</em>元</p>
                                                    <p class="item-desc">用户返利</p>
                                                </li>
                                                <li>
                                                    <p><em>{$vv.p_push_award}</em>元</p>
                                                    <p class="item-desc">投顾返利</p>
                                                </li>
                                                <li>
                                                    <p><em>{$vv.yields}</em></p>
                                                    <p class="item-desc">往期年化</p>
                                                </li>
                                            </ul>
                                            <ul class="item-content-wrapper">
                                                <li>
                                                    <p><em>{$vv.start_amount}</em>元</p>
                                                    <p class="item-desc">起投金额</p>
                                                </li>
                                                <li>
                                                    <p><em>{$vv.deadline}</em><if condition="$vv.deadline_unit eq 0">月<else/>天</if></p>
                                                    <p class="item-desc">投资期限</p>
                                                </li>
                                                <li>
                                                    <!-- <if condition="$v[platform_info][team_type] eq 'ROI'">
                                                        <p>多投多返</p>
                                                        <elseif condition="$v[platform_info][team_type] eq 'CPA'"/>
                                                        <p>首投返利</p>
                                                        <elseif condition="$v[platform_info][team_type] eq 'CPA+CPS'"/>
                                                        <p>首投+加息返利</p>
                                                    </if>

                                                    <p class="item-desc">返利类型</p> -->
                                                    <a href="/Home/Recommend/m_marketing/recommend_id/{$user.id}/p_id/{$vv.platform_id}/s/{$vv.id}"><img src="__PUBLIC__images/send-red-bag.png"></a>
                                                </li>
                                            </ul>
                                    </div>
                                </div>
                            </foreach>
                        </div>
                        <notempty name="v.scheme">
                        <div class="more-btn" onclick="viewMore(this)">更多投资方案</div>
                        </notempty>
                    </li>
                </foreach>
                <foreach name="un_hz_plat" item="v">
                    <li class="my-platform-item">
                        <div class="item-header">
                            <div class="plat-logo-wrapper">
                                <img src="{$v.pic}?x-oss-process=image/resize,w_110" alt="">
                            </div>
                            <div class="plat-return-type-wrapper">
                                <p>{$v.team_type}</p>
                            </div>
                            <div class="spread-btn-wrapper">
                                <a class="spread-btn" href="javascript:" onclick="apply_platfrom({$v.id})">认领平台</a>
                            </div>
                        </div>
                        <div class="item-content">
                            <ul class="item-content-wrapper">
                                <li>
                                    <p><em>{$v.user_award}</em>元</p>
                                    <p class="item-desc">用户返利</p>
                                </li>
                                <li>
                                    <p><em>{$v.push_award}</em>元</p>
                                    <p class="item-desc">投顾返利</p>
                                </li>
                                <li>
                                    <p><em>{$v.yields}</em></p>
                                    <p class="item-desc">往期年化</p>
                                </li>
                            </ul>
                            <ul class="item-content-wrapper">
                                <li>
                                    <p><em>{$v.start_amount}</em>元</p>
                                    <p class="item-desc">起投金额</p>
                                </li>
                                <li>
                                    <p><em>{$v.deadline}</em></p>
                                    <p class="item-desc">投资期限</p>
                                </li>
                                <li>
                                    <if condition="$v[team_type] eq 'ROI'">
                                        <p>多投多返</p>
                                        <elseif condition="$v[team_type] eq 'CPA'"/>
                                        <p>首投返利</p>
                                        <elseif condition="$v[team_type] eq 'CPA+CPS'"/>
                                        <p>首投+加息返利</p>
                                    </if>

                                    <p class="item-desc">返利类型</p>
                                </li>
                            </ul>
                        </div>
                    </li>
                </foreach>

            </ul>
        </div>
          </div>
          <!-- 没有数据敬请期待 -->
          <div class="no-item-wrapper">
            <div class="no-item">
              <img src="__PUBLIC__images/pushercenter-no-item-wrapper.png">
              <p>敬请期待</p>
            </div>
          </div>
        </div>
       
       <notempty name="r">
      <div class="loading clearfix">
        <span class="loading-left"></span>
        <p>加载中</p>
        <span class="loading-right"></span>
      </div>
      <div class="base-line clearfix">
        <span class="base-left"></span>
        <p>我是有底线的</p>
        <span class="base-right"></span>
      </div>
      </notempty>
      </div>
    </block>
    <block name="js">
      <script type="text/javascript">

      var p = 1;
      var status = 1;
       var is_val = 5;
      $(function(){
       $(window).scroll(function() {
            if(status==1){
               if($(document).scrollTop()==$(document).height()-$(window).height()){
                    $('.loading').css('display','block');
                    $('.base-line').css('display','none');
                      get_more_active(is_val,p,1)
                      p = p+1;
                }
            }
             
               
      });
      })
     


        function change(val){
      p = 1;
          is_val = val
           get_more_active(val,1,0,1)
        }

        function get_more_active(val,p,ispage,is_change){
          var userid = "{$_SESSION['user']['id']}"
                $.post('/Home/Person/ajax_get_trend',{
                  userid :userid,
                  is_self:1,
                  val:val,
                  p:p
                },function(res){
        $('.navigation').hide()
                  if(res.content==''){
          
                    status==0
                    $('.loading').css('display','none');
                    $('.base-line').css('display','block');
            if(is_change){
            var hh=''
            hh+='<div class="no-item-wrapper" style="display: block;"><div class="no-item"><img src="/App/Home/Public/images/pushercenter-no-item-wrapper.png"><p>暂无内容</p></div></div>'
              $('.my-active').html(hh)
            }
                  }else{
                   if(ispage){
                     $('.my-active').append(res.content)
                    }else{
                      $('.my-active').html(res.content)
                    }
                    
                  }
                 
                })

        }
  function comment_praise(obj,id){
    $.post('{:U("Praise/ajax_praise")}',{
                id:id,
                video_id:id,
                type:3,
            },function(res){
              console.log(res)
               if(res.err==0){
                  $(obj).removeClass('item-no')
                  $(obj).addClass('item-good')
                  $(obj).find('img').attr('src','/App/Home/Public/images/comment-good.png')
                  var num = $(obj).find('span').text()
                  var n =parseInt(num)+1
                  $(obj).find('span').text(n)

               }else if(res.err==2){
                    layer.open({
                      content: res.msg
                      ,skin: 'msg'
                      ,time: 1
                      ,end: function () {
                              location.href = "/Home/User/login?callback=/Home/circle/depth_info/id/{$_GET['id']}/platform_id/{$_GET['platform_id']}"
                            }
                      });
               }else{
                    layer.open({
                      content: res.msg
                      ,skin: 'msg'
                      ,time: 1
                      });
               }
    })
  }
  function praise(obj,type,id){
        var userid = "{$_SESSION['user']['id']}"
         if(!userid){
            layer.open({
                    content: '请先登录！'
                    , skin: 'msg'
                    , time: 1
                    , end: function () {
                        location.href = "/Home/User/login?callback=/Home/circle/commentary_info/id/{$_GET['id']}/platform_id/{$_GET['platform_id']}"
                    }
                });
        }
        if(type==1){
          var postdata = {commentid:id,id:id,type:6}
        }else if(type==2){
          var postdata = {announceid:id,id:id,type:9}
        }else if(type==3){
          var postdata = {opinionid:id,id:id,type:8}
        }else if(type==4){
          var postdata = {depthid:id,id:id,type:7}
        }
        
          $.post('/Home/Praise/ajax_praise',postdata,function(res){
            if(res.err==0){
              $(obj).removeClass('item-no')
              $(obj).addClass('item-good')
              $(obj).find('img').attr('src','/App/Home/Public/images/comment-good.png')
              var num=parseInt($(obj).find('span').text())
              num = num+1
              $(obj).find('span').text(num)
            }else{
              layer.open({
                    content: res.msg
                    , skin: 'msg'
                    , time: 1
                    
              });
            }
          })
        
  }


       var height = $('body').height();
      // 搜索弹窗
      $('.more').click(function () {
        if($('.navigation').css('display')=='block'){
          $('.navigation').css('display', 'none');
          $('.my-active').css('top','0');
        }else if($('.navigation').css('display')=='none'){
          $('.navigation').css('display', 'block');
          var top = $('.more').offset().top+25;
          $('.navigation').css('top',top);
        }
      });

      // tab切换
      $('.tab > ul > li > div > h4').click(function(){
        $('.tab > ul > li > div > h4').each(function(i,e){
            $(e).removeClass('tab-active');
        });
        var cName = $(this)[0].className;
        switch(cName){
          case 'mc': $('.chat-con').css('display','none');
                $('.viewport').css('display','none');
                $('.my-platform').css('display','none');
                $('.no-item-wrapper').css('display','none');
                $('.my-con').css('display','block');
                $('.loading').show()
                break;
          case 'ch': $('.my-con').css('display','none');
                $('.my-platform').css('display','none');
                $('.viewport').css('display','none');
                $('.no-item-wrapper').css('display','none');
                $('.chat-con').css('display','block');
                $('.loading').hide()
                height = $('body').height();
                //获取聊天列表
                $.post('/Home/person/get_friends',{},function(res){
                  console.log(res)
                  var h ='';
                  $(res).each(function(i,v){
                    if(v.type==2){
                    console.log(v.group_info.platform_id)
                  }
                    h+='<li class="list-li" > <div class="chat-item clearfix" onclick="'
                    if(v.type==2){
                      h+="location.href='/Home/Im/group/id/"+v.group_info.platform_id+"'"
                    }else if(v.type==3){
                      h+="location.href='/Home/Im/group/id/"+v.group_main+"/pushid/"+v.group_main+"'"
                    }else{
                      h+="location.href='/Home/Im/talk/id/"+v.user_info.id+"'"
                    }
                    h+='"><div class="chat-left">'
                    h+='<div class="chat-icon">'
                    if(v.type==2){
                      h+='<img src="__PUBLIC__images/chat-icon.png">'
                    }else if(v.type==3){
                      h+='<img src="__PUBLIC__images/chat-icon.png">'
                    }else{
                      h+='<img src="'+v.user_info.url_img+'">'
                    }
                    h+='</div>'
                    if(v.is_noread_count>0){
                      if(v.type==1){
                        h+='<span class="chat-tip">'+v.is_noread_count+'</span>'
                      }
                     
                    }
                    h+='</div>'
                    h+='<div class="chat-right">'
                    if(v.type==2){
                      h+='<h4>'+v.group_info.name+'</h4>'
                    }else if(v.type==1){
                      h+='<h4>'+v.user_info.nickname+'</h4>'
                    }else if(v.type==3){
                      if(v.group_main=="{$user.id}"){
                         h+='<h4>我的投顾的群</h4>'
                      }else{
                         h+='<h4>师父的群</h4>'
                      }
                     
                    }
                    
                    h+='<p>'+v.lats_chat.content+'</p>'
                    h+='</div>'
                    h+='</div>'
                    h+='<span  class="delete">删除</span>'
                    if(v.type==2){
                      h+='<span class="delete-sure" attr_type="'+v.type+'" attr_id = "'+v.id+'">确认删除</span>'
                    }else{
                      h+='<span class="delete-sure" attr_type="'+v.type+'" attr_id = "'+v.id+'">确认删除</span>'

                    }
                    h+='</li>'
                  })
                  console.log(h)
                  $('.chat-list ul').html(h)
                  })
                break;
          case 'vp': $('.my-con').css('display','none');
                $('.my-platform').css('display','none');
                $('.chat-con').css('display','none');
                $('.no-item-wrapper').css('display','none');
                $('.viewport').css('display','block');
                $('.loading').hide() 
                var userid = "{$_SESSION['user']['id']}"
                $.post('/Home/Person/ajax_get_trend',{
                  userid :userid,
                  is_self:0
                },function(res){
                  $('.dynamic-con ul').html(res.content)
                })

                break;
          case 'sug': $('.my-con').css('display','none');
                $('.viewport').css('display','none');
                $('.chat-con').css('display','none');
                $('.no-item-wrapper').css('display','none');
                $('.my-platform').css('display','block');
                $('.loading').hide()
                break;
          case 'cheats' :  $('.no-item-wrapper').css('display','block');
                $('.my-con').css('display','none');
                $('.viewport').css('display','none');
                $('.chat-con').css('display','none');
                $('.my-platform').css('display','none');
                $('.loading').hide()
                break;     
          case 'life' :  $('.no-item-wrapper').css('display','block');
                $('.my-con').css('display','none');
                $('.viewport').css('display','none');
                $('.chat-con').css('display','none');
                $('.my-platform').css('display','none');
                $('.loading').hide()
                break;
        }
        $(this).addClass('tab-active');
      })


 /*
  * 描述：html5苹果手机向左滑动删除特效
  */
 window.addEventListener('load', function() {
  var initX; //触摸位置
  var moveX; //滑动时的位置
  var X = 0; //移动距离
  var objX = 0; //目标对象位置

  window.addEventListener('touchstart', function(event) {
   // event.preventDefault();
   var obj = event.target.parentNode.parentNode.parentNode;

   if (obj.className == "list-li") {
    initX = event.targetTouches[0].pageX;
    objX = (obj.style.WebkitTransform.replace(/translateX\(/g, "").replace(/px\)/g, "")) * 1;
    if(objX){

    }
   }
    $('.delete').click(function(){   
      $(this).next().css('display','block');
      $(this).css('display','none');
    });
    $('.delete-sure').click(function(){  
     //onsole.log(123)
      $(this).parent('li').remove(); 
      $(this).next().css('display','block');
      $(this).css('display','none');
      var type = $(this).attr('attr_type');
      var id = $(this).attr('attr_id');
      $.post('/home/im/del_friend',{
        type:type,
        id:id
      },function(res){
        // if(res.err==1){
        //   layer.open({
        //   content: res.msg
        //   ,skin: 'msg'
        //   ,time: 1
        //   });
        // }
          
      })
    });
   if (objX == 0) {
    window.addEventListener('touchmove', function(event) {
      $('.delete-sure').css('display','none');
      $('.delete').css('display','block');
     // event.preventDefault();
     var obj = event.target.parentNode.parentNode.parentNode;
     if (obj.className == "list-li") {
      moveX = event.targetTouches[0].pageX;
      X = moveX - initX;
      if (X >= 0) {
       obj.style.WebkitTransform = "translateX(" + 0 + "px)";
      } else if (X < 0) {
       var l = Math.abs(X);
       obj.style.WebkitTransform = "translateX(" + -l + "px)";
       if (l > 80) {
        l = 80;
        obj.style.WebkitTransform = "translateX(" + -l + "px)";
       }
      }
     }
    });
   } else if (objX < 0) {
    window.addEventListener('touchmove', function(event) {
     // event.preventDefault();
     var obj = event.target.parentNode;
     if (obj.className == "list-li") {
      moveX = event.targetTouches[0].pageX;
      X = moveX - initX;
      if (X >= 0) {
       var r = -80 + Math.abs(X);
       obj.style.WebkitTransform = "translateX(" + r + "px)";
       if (r > 0) {
        r = 0;
        obj.style.WebkitTransform = "translateX(" + r + "px)";
       }
      } else { //向左滑动
       obj.style.WebkitTransform = "translateX(" + -2 + "rem)";
      }
     }
    });
   }
 
  })
  window.addEventListener('touchend', function(event) {
   // event.preventDefault();
   var obj = event.target.parentNode;
   if (obj.className == "list-li") {
    objX = (obj.style.WebkitTransform.replace(/translateX\(/g, "").replace(/px\)/g, "")) * 1;
    if (objX > -40) {
     obj.style.WebkitTransform = "translateX(" + 0 + "px)";
     objX = 0;
    } else {
     obj.style.WebkitTransform = "translateX(" + -2 + "rem)";
     objX = -80;
    }
   }
  })
 })    
      
// 聊天搜索
      $('.search-inp').focus(function() {
        var top = $('.tab').offset().top;
        $('body').css('height',height+top);
        $("html,body").animate({scrollTop:top},1000);
        $('.search-inp').css('width', '8rem');
        $('.placehold').css('display','none');
        $('.search span').css('display','block');
      });
      $('.placehold').click(function(){
        var top = $('.tab').offset().top;
        $('body').css('height',height+top);
        $("html,body").animate({scrollTop:top},1000);
        $('.search-inp').css('width', '8rem');
        $('.placehold').css('display','none');
        $('.search span').css('display','block');
      })
      $('.search span').click(function(){
        $('.search-inp').css('width', '9.1rem');
        $('.search-inp').val('');
        $('#list').find("li").slideDown();
        $('.search span').css('display','none');
        $('.placehold').css('display','block');
        $("html,body").animate({scrollTop:0},1000);
        var top = $('.search').offset().top;
        $('body').css('height',height-top);
      })
      </script>
      <script> 
(function ($) {
  jQuery.expr[':'].Contains = function(a,i,m){
      return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
  };
  function filterList(header, list) { 

  $('.search-inp')
      .change( function () {
        var filter = $(this).val();
        if(filter) {
          $matches = $(list).find('h4:Contains(' + filter + ')').parent().parent().parent();
          $('li', list).not($matches).slideUp();
          $matches.slideDown();
        } else {
          $(list).find("li").slideDown();
        }
        return false;
      })
    .keyup( function () {
        $(this).change();
    });
  }
  $(function () {
    filterList($("#form"), $("#list"));
  });
}(jQuery));
            var itemH = $(".platform-wrapper").height();
   function viewMore(obj) {
            if ($(obj).text() == "更多投资方案") {
                $(obj).text("收起更多方案")
                $(obj).parent().children(".platform-wrapper").css("maxHeight", "100%")
            } else {
                $(obj).text("更多投资方案")
                var itemH = $(".platform-wrapper .platform-item").height();
                $(obj).parent().children(".platform-wrapper").css("maxHeight", itemH)
            }
        }
  if('{$user.role}'==2){
    var rolename="投顾"
    var desc = '{$r_info.year|default="-"}年网贷投资经验，投资平台{$r_info.pit_num|default="-"}家，{$r_info.pit_num|default="-"}踩雷！'
  }else{
    var rolename="投资者"
    var desc = ' '
  }
  var title="{$user.nickname}的"+rolename+"主页-8号金融街！"
    
    var link=window.location.href+"/id/{$user.id}"
    var imgUrl='http://wei.8hjie.com/App/Home/Public/images/chat-icon.png' 
  
  
  var oFReader = new FileReader();
        var rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;

        oFReader.onload = function (oFREvent) {
            document.getElementById("uploadPreview").src = oFREvent.target.result;
        };

        function loadImageFile() {
            if (document.getElementById("uploadImage").files.length === 0) {
                return;
            }
            var oFile = document.getElementById("uploadImage").files[0];
            if (!rFilter.test(oFile.type)) {
                alert("You must select a valid image file!");
                return;
            }
            oFReader.readAsDataURL(oFile);
        }

        //    修改头像功能
        var oFReader = new FileReader();
        var rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;

        oFReader.onload = function (oFREvent) {
            document.getElementById("uploadPreview").src = oFREvent.target.result;
            $.post('/Home/Person/change_head_pic',{
                file:oFREvent.target.result
            },function(res){
                if(res.errorCode==1) {
                    layer.open({
                        content: res.msg
                        , skin: 'msg'
                        , time: 1
                    });
                }
            })
        };

        function loadImageFile() {
            if (document.getElementById("uploadImage").files.length === 0) { return; }
            var oFile = document.getElementById("uploadImage").files[0];
            if (!rFilter.test(oFile.type)) { alert("You must select a valid image file!"); return; }
            oFReader.readAsDataURL(oFile);
        }

        function changeAvatar() {

//        底部对话框
            layer.open({
                content: ''
                ,className: 'avatar-layer'
                ,btn: ['取消', '从相册选择']
                ,skin: 'footer'
                ,no: function () {
                    $('#uploadImage').click()
                    layer.closeAll()
                }
                ,yes: function(index){
                    layer.close(index);
                }
            });
        }
		
</script>
</block>